package org.aptu.sd.model;

/**
 * Created by IntelliJ IDEA.
 * User: andrey
 * Date: 12/7/11, 10:27 AM
 */
public class Amount {
    private long rawAmount;

    public Amount(long rawAmount) {
        this.rawAmount = rawAmount;
    }

    public long getRawAmount() {
        return rawAmount;
    }

    public Amount subtractPercent(int percent) {
        return new Amount(rawAmount - rawAmount*percent/100);
    }

    public boolean equals(Object o) {
        return o instanceof Amount && ((Amount)o).getRawAmount() == rawAmount;
    }

    public int hashCode() {
        return new Long(rawAmount).hashCode();
    }

    public String toString() {
        return String.valueOf(rawAmount);
    }
}
